cmake_minimum_required(VERSION 2.6)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(common)

# find library
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})

if (WINDOWS)
add_definitions(-D__WINDOWS__)
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else ()
add_definitions(-D__LINUX__)
	if (CMAKE_COMPILER_IS_GNUCXX)
	add_definitions(-std=gnu++0x)
	else ()
	add_definitions(-std=stdc++11)
	endif()
endif()

if (DEBUG)
add_definitions(-D_DEBUG)
endif()

set(common_SOURCES
	logger/Logger.hpp
	logger/Logger.cpp

	packet/PacketIDs.hpp
	packet/Packet.hpp
	packet/Packet.cpp
	packet/PacketFactory.hpp
	packet/PacketFactoryManager.hpp
	packet/PacketFactoryManager.cpp
	packet/EchoPacket.hpp
	packet/EchoPacket.cpp
	packet/EchoPacketHandler.cpp
	
	player/Player.hpp
	player/Player.cpp
	player/PlayerFactory.hpp
	player/PlayerManager.hpp
	player/PlayerManager.cpp
)

if (WINDOWS)
set(plat_SRC
	net/WSAInitialize.hpp
)
else()
set(plat_SRC
)
endif()

if (WINDOWS)
include_directories( 
	"${PROJECT_SOURCE_DIR}/../"
	"${PROJECT_SOURCE_DIR}/../deps/dev"
)
else ()
include_directories(
	"${PROJECT_SOURCE_DIR}/../"
	"${PROJECT_SOURCE_DIR}/../deps/dev"
)
endif()

add_library(common ${common_SOURCES} ${plat_SRC})
